<?php if(!defined('HDWIKI_ROOT')) exit('Access Denied');?>
<?php include $this->gettpl('admin_header');?>
<script type="text/JavaScript">
function showPanel(panelId, show) {
	if(show == '1') {
		$("#"+panelId).show();
	} else {
		$("#"+panelId).hide();
	}
}

function checkform(){
	var dv = $("input[name*='duration']").val();
	var bv = $("input[name*='ban_time']").val();
	var pv = $("input[name*='pages']").val();
	if ( isNaN(dv) || isNaN(bv) || isNaN(pv) || dv < 1 || bv < 1 || pv < 1){
		$.dialog.box('immageshow', '注意', '访问频率判断规则中的时间和页数必须是大于0的整数');
		return false;
	}
}

</script> 
<p class="map">全局：扩展设置</p>
<p class="sec_nav">扩展设置：
    <a href="index.php?admin_setting-sec" > <span>防灌水设置</span></a>
    <a href="index.php?admin_setting-anticopy" class="on"><span>防采集设置</span></a>
    <a href="index.php?admin_setting-mail"><span>邮件设置</span></a>
    <a href="index.php?admin_setting-noticemail"><span>邮件提醒设置</span></a>
    <a href="index.php?admin_banned" ><span>IP禁止</span></a>
    <a href="index.php?admin_setting-passport" ><span>通行证设置</span></a>
    <a href="index.php?admin_setting-ucenter"><span>UCenter设置</span></a>
    <a href="index.php?admin_setting-ldap"><span>LDAP设置</span></a>
</p>
<h3 class="col-h3">防采集设置</h3>
<form id="waterform" method="POST" action="index.php?admin_setting-anticopy" onsubmit="return checkform();">
	<table class="table">
		<tr>
			<td width="300px"><span>字符串混淆是否开启</span>开启后将使用下面框中的字符串在正文中做混淆。</td>
			<td>
			<label><input <?php if($config['random_open'] ) { ?>checked<?php } ?> type="radio" name="random_open" value="1" onclick="showPanel('randomStrPanel', this.value);" />是</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<label><input <?php if(!$config['random_open'] ) { ?>checked<?php } ?> type="radio" name="random_open" value="0"  onclick="showPanel('randomStrPanel', this.value);" />否</label></td>
		</tr>
		<tbody id="randomStrPanel" <?php if(!$config['random_open'] ) { ?>style="display:none"<?php } ?>>
		<tr>
			<td><span>混淆字符串</span>这里写字符串，换行分开，如果为空相当于关闭。</td>
			<td ><textarea class="textarea" name="random_text" cols="50" rows="7"><?php echo $config['random_text']?></textarea></td>
		</tr>
		</tbody>
		<tr>
			<td width="300px"><span>UserAgent 判断是否开启</span></td>
			<td>
			<label><input <?php if($config['check_useragent'] ) { ?>checked="checked"<?php } ?> type="radio" name="check_useragent" value="1" onclick="showPanel('UAPanel', this.value);" />是</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<label><input <?php if(!$config['check_useragent'] ) { ?>checked="checked"<?php } ?> type="radio" name="check_useragent" value="0" onclick="showPanel('UAPanel', this.value);" />否</label></td>
		</tr>
		<tbody id="UAPanel" <?php if(!$config['check_useragent'] ) { ?>style="display:none"<?php } ?>>
		<tr>
			<td><span>判断方式</span></td>
			<td><label><input type="radio" name="ua_allow_first" value="1" <?php if($config['ua_allow_first'] ) { ?>checked="checked"<?php } ?> /> 只禁止出现在黑名单中的UserAgent访问，其他则允许</label><br />
				<label><input type="radio" name="ua_allow_first" value="0" <?php if(!$config['ua_allow_first'] ) { ?>checked="checked"<?php } ?> /> 只允许出现在白名单中的UserAgent访问，其他则禁止</label><br />
				当黑白名单中的关键字<u>同时出现</u>于UserAgent字符串中时：
					<label><input type="radio" name="allow_ua_both" value="1" <?php if($config['allow_ua_both'] ) { ?>checked="checked"<?php } ?> />允许访问 </label>&nbsp;&nbsp;
					<label><input type="radio" name="allow_ua_both"  value="0" <?php if(!$config['allow_ua_both'] ) { ?>checked="checked"<?php } ?> />禁止访问  </label>
			</td>
		</tr>
		<tr>
			<td><span>UserAgent名单</span>设置UserAgent黑白名单关键字<br />每个关键字用换行分开</td>
			<td ><table><tr><td style="border: 0; padding: 0 10px 0 0; margin:0;">
				黑名单：<br />
				<textarea class="textarea" name="ua_blacklist" cols="50" rows="7">
<?php echo $config['ua_blacklist']?>
</textarea>
			</td><td style="border: 0; padding: 0 10px 0 0; margin:0;">
				白名单：<br />
				<textarea class="textarea" name="ua_whitelist" cols="50" rows="7">
<?php echo $config['ua_whitelist']?>
</textarea>
			</td></tr></table></td>
		</tr>
		</tbody>
		
		<tr>
			<td><span>访问频率判断是否开启</span></td>
			<td>
			<label><input <?php if($config['check_visitrate'] ) { ?>checked<?php } ?> type="radio" name="check_visitrate" value="1" onclick="showPanel('VisitRatePanel', this.value);" />是</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<label><input <?php if(!$config['check_visitrate'] ) { ?>checked<?php } ?> type="radio" name="check_visitrate" value="0" onclick="showPanel('VisitRatePanel', this.value);" />否</label></td>
		</tr>
		<tbody id="VisitRatePanel" <?php if(!$config['check_visitrate'] ) { ?>style="display:none"<?php } ?>>
		<tr>
			<td><span>访问频率判断规则</span>设置访问频率判断规则<br />IP地址列表中每行一个IP，可以使用 * 通配符。<br />示例：<br />64.68.*.*<br />127.0.0.1</td>
			<td>当每 <input type="text" class="ipt_txt" style="width: 40px" name="visitrate[duration]" value="<?php echo $config['visitrate']['duration']?>" /> 秒钟访问词条详情页超过
				<input type="text" class="ipt_txt" style="width: 40px" name="visitrate[pages]" value="<?php echo $config['visitrate']['pages']?>" /> 页时，自动将此IP加入IP禁止名单，
				<input type="text" class="ipt_txt" style="width: 40px" name="visitrate[ban_time]" value="<?php echo $config['visitrate']['ban_time']?>" /> 小时内禁止访问。
				<br />
			但如下IP地址除外（可将主要搜索引擎蜘蛛的IP地址加入以免误屏蔽）：<br />
			<textarea class="textarea" name="visitrate_ip_exception" cols="50" rows="7"><?php echo $config['visitrate_ip_exception']?></textarea>
			</td>
		</tr>
		</tbody>
		<tr>
			<td colspan="2"><input class="inp_btn" name="settingsubmit" value="提 交" type="submit"></td>
		</tr>
	</table>
</form>
<?php include $this->gettpl('admin_footer');?>